package com.example.ang.tripapp.activities;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;

import com.example.ang.tripapp.R;
import com.example.ang.tripapp.base.BaseActivity;

public class GuideActivity extends BaseActivity {
    /**
     * 表层图像
     * */
    private ImageView iv;
    /**
     * 处理消息，进入MainActivity
     * */
    private Handler handler=new Handler();
    @Override
    protected void loadXml() {
        setContentView(R.layout.activity_guide);
    }

    @Override
    protected void getIntentData(Bundle savedInstanceState) {
    }

    @Override
    protected void initView() {
        iv = (ImageView) findViewById(R.id.iv);
    }

    @Override
    protected void setListener() {
    }

    @Override
    protected void initData() {
        Animation animation= AnimationUtils.loadAnimation(getApplicationContext(), R.anim.fade);
        animation.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {
            }

            @Override
            public void onAnimationEnd(Animation animation) {
            handler.postDelayed(new Runnable() {
                @Override
                public void run() {
                    startActivity(new Intent(GuideActivity.this,MainActivity.class));
                    finish();
                    overridePendingTransition(R.anim.slide_left,0);
                }
            },500);
            }

            @Override
            public void onAnimationRepeat(Animation animation) {
            }
        }
);
        iv.startAnimation(animation);
        }}

